<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
	<title>Title</title>
	<jsp:include page="../layout/_import.jsp"></jsp:include>

	<style>
		.invalid {
			color: red;
		}
	</style>
</head>
<body>
<jsp:include page="../layout/_nav.jsp"></jsp:include>
<div class="container">
	<main role="main" class="pb-3">
		<c:if test="${not empty msg}">
			<div class="alert alert-danger" role="alert">
					${msg}
			</div>
		</c:if>
		<form action="/custom" method="post" novalidate="novalidate">
			<input type="hidden" name="m" value="edit">
            <input type="hidden" name="id" value="${user.id}">
			<div class="form-group row">
				<label class="col-sm-2" for="name">客户姓名</label>
				<div class="col-sm-10">
					<input value="${user.name}" class="form-control" type="text" data-val="true" data-val-maxlength="长度不能超过10" data-val-maxlength-max="20" data-val-required="名称是必须的" id="name" maxlength="10" name="name">
					<span class="invalid field-validation-valid" data-valmsg-for="name" data-valmsg-replace="true"></span>
				</div>
			</div>

			<div class="form-group row">
				<label class="col-sm-2" for="tel">联系电话</label>
				<div class="col-sm-10">
					<input value="${user.tel}" class="form-control" type="tel" data-val="true" data-val-required="电话是必须的" id="tel" name="tel">
					<span class="invalid field-validation-valid " data-valmsg-for="tel" data-valmsg-replace="true"></span>
				</div>
			</div>

			<div class="form-group row">
				<label class="col-sm-2" for="address">家庭住址</label>
				<div class="col-sm-10">
					<input value="${user.address}" class="form-control" type="text" list="address" data-val="true" data-val-maxlength="地址长度不能大于20" data-val-maxlength-max="100" data-val-required="地址是必要的" id="address" maxlength="20" name="address">
					<span class="invalid field-validation-valid" data-valmsg-for="address" data-valmsg-replace="true"></span>
				</div>
			</div>
			<input type="submit" class="btn btn-primary" value="保存更改"/>
			<a class="btn btn-secondary" href="/custom">返回列表</a>
	</main>
</div>
<script src="https://cdn.bootcss.com/jquery-validate/1.19.1/jquery.validate.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"></script>
</body>
</html>
